package com.sgb.kjwl.model.entity;

import android.os.Parcel;
import android.os.Parcelable;

import com.google.gson.annotations.SerializedName;
import com.sgb.kjwl.R;
import com.swgk.core.recyclerview.secondary.SecondaryEntity;

//材料菜单选项
public class SecondCategoryEntity extends SecondaryEntity {
    private String appIconUrl = "https://shigongbang.oss-cn-hangzhou.aliyuncs.com/";
    //                               https://shigongbang.oss-cn-hangzhou.aliyuncs.com/
    @SerializedName(value = "no", alternate = {"id"})
    private String id= "";
    @SerializedName("name")
    private String name;
    @SerializedName(value = "appIcon", alternate = {"icon"})
    private String appIcon;
    @SerializedName(value = "appImg", alternate = {"img"})
    private String appImg;
    @SerializedName("selected")
    private boolean selected;
    @SerializedName("imageResource")
    private int imageResource = R.drawable.null_img_list;

    public int getImageResource() {
        return imageResource;
    }

    public void setImageResource(int imageResource) {
        this.imageResource = imageResource;
    }

    public boolean isSelected() {
        return selected;
    }

    public void setSelected(boolean selected) {
        this.selected = selected;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAppImg() {
        if (appImg == null) {
            return "";
        } else if (appImg.contains(appIconUrl)) {
            return appImg;
        } else {
            return appIconUrl + appImg;
        }
    }

    public void setAppImg(String appImg) {
        this.appImg = appImg;
    }

    public String getAppIcon() {
        if (appIcon == null) {
            return "";
        } else if (appIcon.contains(appIconUrl)) {
            return appIcon;
        } else {
            return appIconUrl + appIcon;
        }
    }

    public void setAppIcon(String appIcon) {
        this.appIcon = appIcon;
    }
}
